package cn.yangliu.nacos.comm.config.security.handler;

import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;

/**
 * The interface Security adapter.
 *
 * @author 问道于盲
 */
public interface SecurityAdapter {

    /**
     * Configure.
     *
     * @param web the web
     */
    default void configure(WebSecurity web) {

	}

    /**
     * Configure.
     *
     * @param http the http
     * @throws Exception the exception
     */
    default void configure(HttpSecurity http) throws Exception {

	}

    /**
     * Configure expression url authorization configurer . expression intercept url registry.
     *
     * @param registry the registry
     * @return the expression url authorization configurer . expression intercept url registry
     * @throws Exception the exception
     */
    default ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry configure(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) throws Exception{
		return registry;
	}


    /**
     * 参考如下
     *
     * @param auth the auth
     * @throws Exception the exception
     * @see WebSecurityConfigurerAdapter#configure(AuthenticationManagerBuilder) WebSecurityConfigurerAdapter
     * #configure(AuthenticationManagerBuilder)WebSecurityConfigurerAdapter #configure(AuthenticationManagerBuilder)
     */
    default void configure(AuthenticationManagerBuilder auth) throws Exception{

	}

}
